package com.xnyzc.lhy.common.penum.approval;

/**
 * @Description 审批订单状态
 * @Author 刘举
 * @Date 2019/8/12 11:25
 **/
public enum EApprovalOrderStatus {

    pending(0, "待审批"),
    approvaling(1, "审批中"),
    pass(2, "通过"),
    reject(3, "驳回"),
    cancel(4, "取消申请");


    private Integer value;

    private String desc;

    EApprovalOrderStatus(Integer value, String desc){
        this.value = value;
        this.desc = desc;
    }

    public static EApprovalOrderStatus findById(Integer value) {
        EApprovalOrderStatus eApprovalOrderStatus;
        switch (value) {
            case 0:
                eApprovalOrderStatus = EApprovalOrderStatus.pending;
                break;
            case 1:
                eApprovalOrderStatus = EApprovalOrderStatus.approvaling;
                break;
            case 2:
                eApprovalOrderStatus = EApprovalOrderStatus.pass;
                break;
            case 3:
                eApprovalOrderStatus = EApprovalOrderStatus.reject;
                break;
            case 4:
                eApprovalOrderStatus = EApprovalOrderStatus.cancel;
                break;
            default:
                throw new IllegalArgumentException("非法type");
        }
        return eApprovalOrderStatus;
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }
}
